package com.wx.thread;

/**
 * @description: synchronized 关键字的使用
 * @author: wangxun
 * @createDate: 2021/4/6
 * @version: 1.0
 */
public class SyncTest {
    private Object lock;

    private synchronized int  add(int i, int j){
        return i+j;
    }
    private int sub (int i , int j){
        synchronized (lock){
            return j-i;
        }
    }
}
